/**
 * Copyright (c) 2014-2015, Suredy technology Co., Ltd. All rights reserved.
 * 
 * @author ZhangMaoren
 * @since 2015年7月14日
 * @version 0.1
 */
package com.suredy.resource.model;

import java.io.Serializable;
import java.util.Date;

import com.suredy.resource.entity.ResourceEntity;

/**
 * @author ZhangMaoren
 *
 */
public class Resource implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3179796818869754720L;

	private String id;

	private Date createTime;

	private Date lastModifiedTime;

	private String name;

	private Integer type;

	private String uri;
	
	
	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	
	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	
	/**
	 * @return the createTime
	 */
	public Date getCreateTime() {
		return createTime;
	}

	
	/**
	 * @param createTime the createTime to set
	 */
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	
	/**
	 * @return the lastModifiedTime
	 */
	public Date getLastModifiedTime() {
		return lastModifiedTime;
	}

	
	/**
	 * @param lastModifiedTime the lastModifiedTime to set
	 */
	public void setLastModifiedTime(Date lastModifiedTime) {
		this.lastModifiedTime = lastModifiedTime;
	}

	
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	
	/**
	 * @return the type
	 */
	public Integer getType() {
		return type;
	}

	
	/**
	 * @param type the type to set
	 */
	public void setType(Integer type) {
		this.type = type;
	}

	
	/**
	 * @return the uri
	 */
	public String getUri() {
		return uri;
	}

	
	/**
	 * @param uri the uri to set
	 */
	public void setUri(String uri) {
		this.uri = uri;
	}
	
	public ResourceEntity toPO(){
		ResourceEntity po = new ResourceEntity();
		if (id != null) {
			po.setId(id);
		}
		po.setCreateTime(createTime);
		po.setLastModifiedTime(lastModifiedTime);
		po.setName(name);
		po.setType(type);
		po.setUri(uri);
		return po;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		Resource other = (Resource) o;

		if (id != null ? !id.equals(other.id) : other.id != null) {
			return false;
		}

		if (name != null ? !name.equals(other.name) : other.name != null) {
			return false;
		}

		if (uri != null ? !uri.equals(other.uri) : other.uri != null) {
			return false;
		}

		return true;
	}

	@Override
	public int hashCode() {
		return ((id != null ? id.hashCode() : 0) + (name != null ? name.hashCode() : 0) + (uri != null ? uri.hashCode() : 0));
	}

	@Override
	public String toString() {
		return "Resource[" + "id=" + id + ", name='" + name + "\'" + ", uri='" + uri + "\'" + "]";
	}
}
